package com.zoho.model_project.task;

import com.zoho.model_project.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
@Configuration
@EnableScheduling
public class ScheduleTask {

    @Autowired
    TestService testService;

    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


    @Scheduled(cron = "0/5 * * * * ?")
    public void testData() {
        log.info("-----开始【CRM模块】定时任务 " + format.format(new Date()) + "-----");
        testService.test();
        log.info("-----结束【CRM模块】定时任务 " + format.format(new Date()) + "-----");
    }
}
